#include <stdio.h>
#include <signal.h>
#include <setjmp.h>
#include <time.h>
#include <sys/stat.h>

#include "core.h"
#include "user_operation.h"

static void deal_ctrl_c(int sig);

#define UNUSED(x) (void)x

static jmp_buf buf;

int main(int argc, char* argv[])
{
    int ret = 0;
    struct core *core = NULL;
    
    signal(SIGINT, deal_ctrl_c);
    
    UNUSED(argc);
    UNUSED(argv);
	
    core = init();

    ret = setjmp(buf);
	
    if (ret != 1) {
    	run(core);
    }

    destroy(core);

    return 0;
}

void deal_ctrl_c(int sig)
{
    longjmp(buf, 1);
}
